﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using LoghogInterface.Commands;
using LoghogInterface.Modules;

namespace LoghogInterface.ViewModels
{
    /// <summary>
    /// Модель представления добавления тегов
    /// </summary>
    class ViewModelAddTag
    {
        public string Tag { get; set; }

        private int _idJournal;
        private TagsSQLHelper _tagsSqlHelper;

        public ViewModelAddTag(int idJournal)
        {
            _tagsSqlHelper = new TagsSQLHelper();
            _idJournal = idJournal;
        }

        #region Commands

        #region Add tag
        private DelegateCommand _addTag;
        public ICommand Add
        {
            get
            {
                if (_addTag == null)
                {
                    _addTag = new DelegateCommand(this.AddTeg);
                }
                return _addTag;
            }
        }

        private void AddTeg()
        {
            _tagsSqlHelper.AddTag(Tag, _idJournal);
        }
        #endregion

        #endregion
    }
}
